Doors Regexp gives the longest possible match of the regular expression. string st = "Comment(Foo1), Issue(Foo2), Location(Foo3)," string sCommentReg = "Result\\((.*)\\)\\," Regexp regComment = regexp sCommentReg
GaborMoizes - Thu Feb 24 12:05:49 EST 2011 |
Re: Shortest possible match with regexp
I cannot modify the post, so I re-post with modification: string st = "Comment(Foo1), Issue(Foo2), Location(Foo3)," string sCommentReg = "Comment\\((.*)\\)\\," Regexp regComment = regexp sCommentReg
|
Re: Shortest possible match with regexp GaborMoizes - Thu Feb 24 12:08:22 EST 2011
I cannot modify the post, so I re-post with modification: string st = "Comment(Foo1), Issue(Foo2), Location(Foo3)," string sCommentReg = "Comment\\((.*)\\)\\," Regexp regComment = regexp sCommentReg
(http://.^\(*). Nope, almost, its ( string st = "Comment(Foo1), Issue(Foo2), Location(Foo3)," // string sCommentReg = "Comment\\((.*)\\)\\," string sCommentReg = "Comment\\(( Regexp regComment = regexp sCommentReg if (regComment st) print stmatch 1 "\n"
Golly, got a memory about "minimum" and "maximum" expression searches... |
Re: Shortest possible match with regexp llandale - Thu Feb 24 14:46:31 EST 2011
Golly, got a memory about "minimum" and "maximum" expression searches... Mental note: use Preview. Remember that. Again... ([.^\\(]*) Nope, almost, its ([^\\(]*) string st = "Comment(Foo1), Issue(Foo2), Location(Foo3)," // string sCommentReg = "Comment\\((.*)\\)\\," string sCommentReg = "Comment\\(([^\\(]*)\\)\\," Regexp regComment = regexp sCommentReg if (regComment st) print st[match 1] "\n"if (regComment st) print stmatch 1 "\n"
|
Re: Shortest possible match with regexp llandale - Thu Feb 24 14:52:08 EST 2011 Mental note: use Preview. Remember that. Again... ([.^\\(]*) Nope, almost, its ([^\\(]*) string st = "Comment(Foo1), Issue(Foo2), Location(Foo3)," // string sCommentReg = "Comment\\((.*)\\)\\," string sCommentReg = "Comment\\(([^\\(]*)\\)\\," Regexp regComment = regexp sCommentReg if (regComment st) print st[match 1] "\n"if (regComment st) print stmatch 1 "\n"
http://gnosis.cx/publish/programming/regular_expressions.html Don't know if that will help.
|
Re: Shortest possible match with regexp Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Shortest possible match with regexp llandale - Thu Feb 24 17:32:03 EST 2011
Ah, greedy ! That was the keyword! I've found a solution usig regexp2 as Mathias suggested. string sregComment = "Comment\\((.*?)\\)\\," Regexp regComment = regexp2 sregComment
|